package com.webapp.view;

import com.alibaba.fastjson.JSONObject;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Resp {

	private int code;
    private String msg;
    private Object data;
	
    public Resp(Object data){
    	this.msg = BaseContants.OK_MSG_STR;
    	this.code = BaseContants.OK_STATUS;
        this.data = data;
    }
    
    public Resp(Object data,int code,String msg){
    	this.msg = msg;
    	this.code = code;
        this.data = data;
    }
    
    public Resp(Boolean status){
    	if(!status) {
    		this.msg = BaseContants.OK_MSG_STR;
    		this.code = BaseContants.ERROR_CODE;
    	}else {
    		this.code = BaseContants.OK_STATUS;
    	}
    }
    
    public String toString() {
    	return JSONObject.toJSONString(this);
    }
}
